import Mock from 'mockjs'

const apps = Mock.mock({
  'list|10': [{
    appInfoId: '@id',
    appType: 'integer(int32)',
    'isMust|1': [1, 2],
    verCode: '@string',
    downLoadPath: 'http://www.baidu.com',
    verInfo: '@string'
  }]
})

const pub = {
  'endRow': 0,
  'firstPage': 0,
  'hasNextPage': true,
  'hasPreviousPage': true,
  'isFirstPage': true,
  'isLastPage': true,
  'lastPage': 0,
  'navigatePages': 0,
  'navigatepageNums': [],
  'nextPage': 0,
  'orderBy': '',
  'pageNum': 0,
  'pageSize': 0,
  'pages': 0,
  'prePage': 0,
  'size': 0,
  'startRow': 0,
  'total': 0
}

export default [
  // App
  // 上传App版本信息
  {
    url: '/general/app/addAppInfo',
    type: 'post',
    response: config => {
      return {
        code: 1,
        data: { ...apps },
        msg: ''
      }
    }
  },
  // 根据App版本ID删除App版本信息
  {
    url: '/general/app/deleteAppInfoById',
    type: 'get',
    response: config => {
      return {
        code: 1,
        data: apps.list[0],
        msg: ''
      }
    }
  },
  // App版本列表
  {
    url: '/general/app/listAppInfo',
    type: 'post',
    response: config => {
      return {
        code: 1,
        data: {
          ...apps,
          ...pub
        },
        msg: ''
      }
    }
  },
  // 修改App版本信息
  {
    url: '/general/app/modifyAppInfo',
    type: 'post',
    response: config => {
      return {
        code: 1,
        data: { ...apps },
        msg: ''
      }
    }
  },
  // 根据App版本ID查询App版本信息
  {
    url: '/general/app/viewAppInfoById',
    type: 'get',
    response: config => {
      return {
        code: 1,
        data: apps.list[0],
        msg: ''
      }
    }
  }
]
